import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.StringTokenizer;

public class StoreRoom {
	private ArrayList<SubFood> ingredientList = new ArrayList<>();

	public StoreRoom(ArrayList<SubFood> aIngredientList) {
		ingredientList = aIngredientList;
	}

	public ArrayList<SubFood> getIngredientList() {
		return ingredientList;
	}

	public void setIngredientList(ArrayList<SubFood> ingredientList) {
		this.ingredientList = ingredientList;
	}

	public ArrayList<SubFood> removeExiredElement(String aDate) {
		String date= aDate;
		int day = 0;
		int month = 0;
		int year = 0;
		StringTokenizer st = new StringTokenizer(date);
		while(st.hasMoreTokens()){
			day=Integer.parseInt(st.nextToken("/"));
			month=1-(Integer.parseInt(st.nextToken("/")));
			year=Integer.parseInt(st.nextToken("/"));
		}
		GregorianCalendar gc= new GregorianCalendar(year,month,day);
		Date dataInserita= new Date(gc.getTimeInMillis());
		SimpleDateFormat dt=new SimpleDateFormat("dd/MM/yyyy");
		String dataInseritaFormatted= dt.format(dataInserita);
		for(int i=0;i<ingredientList.size();i++){
			ingredientList.get(i).getExirationDayGregorian();
		}
		return ingredientList;
	}

	@Override
	public String toString() {
		return "StoreRoom [ingredientList=" + ingredientList + "]";
	}

}
